package view.items;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Insets;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import controller.*;
import model.Call;

public class PanelCallRequest extends PanelAbstract {

	public PanelCallRequest(Call call, Controller controller,ControllerLighter controllerLighter) {
		super(call, controllerLighter);
		JLabel jlabel = new JLabel(call.getFirstName());
		jlabel.setPreferredSize(new Dimension(70,20));
		jlabel.setForeground(this.colorLabel);
		
		JLabel jlabel2 = new JLabel(call.getLastName());
		jlabel2.setPreferredSize(new Dimension(52,20));
		jlabel2.setForeground(this.colorLabel);
		
		JLabel jlabel3 = new JLabel(call.getIp().toString().replace("/", ""));
		jlabel3.setPreferredSize(new Dimension(95,20));
		jlabel3.setForeground(this.colorLabel);
		
		
		ImageIcon iconAccept = new ImageIcon(getClass().getResource("/img/vert.png"));
		//JLabel buttonAccept = new JLabel(iconAccept);
		JButton buttonAccept = new JButton(iconAccept);
		buttonAccept.setFont(new Font("Arial",Font.ITALIC,10));
		buttonAccept.setMargin(new Insets(0, 0, 0, 0));
		buttonAccept.setPreferredSize(new Dimension(23,23));
		buttonAccept.setActionCommand("buttonAccept");
		buttonAccept.addActionListener(controller);
		buttonAccept.setContentAreaFilled(false);
		buttonAccept.setBorderPainted(false);
		buttonAccept.setToolTipText("Click to accept Call");
		
		ImageIcon iconDeny = new ImageIcon(getClass().getResource("/img/rouge.png"));
		JButton buttonDeny = new JButton(iconDeny);
		buttonDeny.setFont(new Font("Arial",Font.ITALIC,10));
		buttonDeny.setMargin(new Insets(0, 0, 0, 0));
		buttonDeny.setPreferredSize(new Dimension(23,23));
		buttonDeny.setActionCommand("buttonDeny");
		buttonDeny.addActionListener(controller);
		buttonDeny.setContentAreaFilled(false);
		buttonDeny.setBorderPainted(false);
		buttonDeny.setToolTipText("Click to deny Call");
		
		this.add(jlabel2);
		this.add(jlabel);
		this.add(jlabel3);
		this.add(buttonAccept);
		this.add(buttonDeny);
	}

}
